//
//  TGMoreItem.m
//  GroupBuy
//
//  Created by wwj on 15/11/2.
//  Copyright © 2015年 wwj. All rights reserved.
//

#import "TGMoreItem.h"
#import "TGNavigationController.h"
#import "TGMoreController.h"

@implementation TGMoreItem

+ (instancetype)moreItem{
    return [[self alloc] init];
}

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self initView];
    }
    return self;
}

- (void) initView{
    self.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
    [self setIcon:@"ic_more" selectIcon:@"ic_more_hl"];
    
    [self addTarget:self action:@selector(onClickMoreBtn) forControlEvents:UIControlEventTouchDown];
}

- (void)onClickMoreBtn{
    self.enabled = NO;
    TGMoreController *moreVC = [[TGMoreController alloc] init];
    TGNavigationController *naVC = [[TGNavigationController alloc] initWithRootViewController:moreVC];
    moreVC.moreItemBtn = self;
    naVC.modalPresentationStyle = UIModalPresentationFormSheet;
    [self.window.rootViewController presentViewController:naVC animated:YES completion:nil];
}

@end
